<?php
namespace Common\Model;
class ConfigModel extends BaseModel {
    protected $num2text = array(
        'type'=>array(
            0=>'数字',
            1=>'字符',
            2=>'文本',
            3=>'数组',
            4=>'枚举',
        ),
    );
    protected $_auto = array(
        array('create_time', NOW_TIME, self::MODEL_INSERT),
        array('update_time', NOW_TIME),
    );
    protected $_validate = array(
        array('name', '', '配置名称已经存在！', 0, 'unique', self::MODEL_BOTH),
        array('name', 'require', '请填写配置名称！'),
        array('title', 'require', '请填写配置标题！'),
    );
    public function _initialize()
    {
        parent::_initialize();
    }
    public function create_conf($name, $title) {}
    protected function _after_find(&$result, $options)
    {
        parent::_after_find($result, $options);
        if($result['group']) {
            $result['group_text'] = M('Category')->getFieldById($result['group'], 'title');
        }
    }
}